import 'package:fish_redux/fish_redux.dart';
import 'package:flutter/material.dart' hide Action;

import 'action.dart';
import 'state.dart';

Widget buildView(
    CameraState state, Dispatch dispatch, ViewService viewService) {
  return Stack(
    alignment: Alignment.center,
    children: <Widget>[
//      Positioned(
//        right: 0,
//        top: 10,
//        width: 150,
//        height: 60,
//        child: GestureDetector(
//          child: Stack(
//            alignment: Alignment.center,
//            children: <Widget>[
//              Positioned(
//                left: 0,
//                right: 0,
//                top: 0,
//                bottom: 0,
//                child:
//                    Image.asset("assets/images/share.png", fit: BoxFit.cover),
//              ),
//              Positioned(
//                right: 24,
//                child: Text("推荐给好友"),
//              ),
//            ],
//          ),
//          onTap: () {
//            dispatch(CameraActionCreator.onShare());
//          },
//        ),
//      ),
      Positioned(
          top: 70,
          right: 10,
          width: 84,
          height: 64,
          child: GestureDetector(
            child: Padding(
              padding: EdgeInsets.fromLTRB(0.0, 20.0, 0.0, 20.0),
              child: Image.asset("assets/images/guide.png", fit: BoxFit.cover),
            ),
            onTap: () {
              dispatch(CameraActionCreator.onGuide());
            },
          )),
      Center(
        child: Column(
          mainAxisSize: MainAxisSize.min,
          children: <Widget>[
            Container(
              width: 200,
              height: 200,
              decoration: BoxDecoration(
                  color: Color(0xff2e3249), shape: BoxShape.circle),
              child: GestureDetector(
                child: Stack(
                  alignment: Alignment.center,
                  children: <Widget>[
                    Positioned(
                      left: 10,
                      right: 10,
                      child: Image.asset("assets/images/star.png",
                          fit: BoxFit.cover),
                    ),
                    Positioned(
                      left: 50,
                      right: 50,
                      top: 40,
                      bottom: 60,
                      child: Image.asset("assets/images/camera.png",
                          fit: BoxFit.cover),
                    ),
                    Positioned(
                      bottom: 36,
                      child:
                          Text("点击拍照批改", style: TextStyle(color: Colors.white)),
                    ),
                  ],
                ),
                onTap: () {
                  dispatch(CameraActionCreator.onCamera());
                },
              ),
            ),
            SizedBox(height: 10),
            Container(
              alignment: Alignment.center,
              height: 32,
              child: FlatButton(
                onPressed: () =>
                    dispatch(CameraActionCreator.onOpenPracticeVoice()),
                child: Row(
                  mainAxisSize: MainAxisSize.min,
                  children: <Widget>[
                    Image.asset("assets/images/voice2.png", fit: BoxFit.cover),
                    Text("语音识别批改"),
                  ],
                ),
              ),
            ),
          ],
        ),
      ),
      Positioned(
        bottom: 24,
        width: 80,
        height: 68,
        child: FlatButton(
          onPressed: () => dispatch(CameraActionCreator.onOpenPracticeList()),
          child: Stack(
            alignment: Alignment.center,
            children: <Widget>[
              Positioned(
                top: 0,
                width: 50,
                height: 50,
                child: Image.asset("assets/images/practice_home_list.png",
                    fit: BoxFit.cover),
              ),
              Positioned(
                bottom: 0,
                child: Text("记录"),
              ),
            ],
          ),
        ),
      ),
    ],
  );
}
